package com.example.springbott.util;

import com.example.springbott.bean.common.PageInfoBase;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class EazyExampleSetUtil {
    public static <T> T setPageAndCondition(T example,PageInfoBase pageInfoBase) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Class<?> exampleClass = example.getClass();
        Method declaredMethod = exampleClass.getDeclaredMethod("setOrderByClause", String.class);
        declaredMethod.invoke(example,pageInfoBase.getSort()+" "+pageInfoBase.getOrder());
        return  example;
    }


}
